home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 April
/
EnigmA AMIGA RUN 17 (1997)(G.R. Edizioni)(IT)[!][issue 1997-04][EAR-CD].iso
/
AntiVirus
/
Virus_Checker
/
ARexx
/
Virus_Checker7.dopus5
Wrap
Text File
|
1995-08-27
|
7KB
|
189 lines
/* Virus_Checker7 for Directory Opus 5 and Virus_Checker 7.
By Leo Davidson ("Nudel", Pot-Noodle/Gods'Gift Utilities)
$VER: Virus_Checker7 1.2 (18.8.95)
NOTE: This script _requires_ DOpus v5.11 or above.
If you include the path of a file/dir on the command line, using a {}, only
this file/dir will be tested. If you omit the {}, the program will check
all selected files and directories in the SOURCE lister for viruses.
If Virus_Checker's ARexx port is not found, the program will be run for
you (you should edit the path below). This means the script may fail if
you give an incorrect path to the Virus_Checker program.
If the Virus_Checker's ARexx port takes over a minute to appear, an error
requester will appear on the DOpus screen and the script will quit.
If Virus_Checker was running to start with, it will be left running after
the script has completed. Otherwise, it will be removed from memory.
When a virus is detected a beep will sound and once all files have been
checked you will get a requester with a list of infected files (including
the type of virus). It is possible that the requester will fail to
appear if it becomes too large to fit on the screen. The script will
detect when this happens and output the results to a shell window instead.
Thanks to John Veldthuis <johnv@tower.actrix.gen.nz> for writting
Virus_Checker, allowing me access to the VC7 beta versions, and for giving
me a virus-infected file (!) to test this script with.
For a "check selected files for viruses" function, call as:
------------------------------------------------------------------------------
ARexx DOpus5:ARexx/Virus_Checker7.dopus5 {Qp} {Ql}
------------------------------------------------------------------------------
Turn off all switches.
For an "Un-LhA to a directory and check for viruses" function, call as:
------------------------------------------------------------------------------
AmigaDOS C:LHA -M x {fu} {d}{ou-}/
ARexx DOpus5:ARexx/Virus_Checker7.dopus5 {Qp} {Ql} {d}{o-}
------------------------------------------------------------------------------
Switches: Do all files
Output to window
Rescan dest
Window close button
v1.00 -> v1.01 - Some minor tidying up.
Now checks to make sure the DOPUS.x port exists.
v1.02 -> v1.3 - Now uses Show() instead of ShowList(). (Thanks Stoebi)
Style Guide compliant version numbering and $VER string.
*/
/*- Path to Virus_Checker command ------------------------------------------*/
Virus_Checker = "DH0:Tools/Harddrive/VirusKillers/Virus_Checker"
/*--------------------------------------------------------------------------*/
options results
options failat 99
signal on syntax;signal on ioerr /* Error trapping */
parse arg DOpusPort source_handle.0 FilePath
DOpusPort = Strip(DOpusPort,"B",'" ')
source_handle.0 = Strip(source_handle.0,"B",'" ')
FilePath = Strip(FilePath,"B",'" ')
If DOpusPort="" THEN Do
Say "Not correctly called from Directory Opus 5!"
Say "Load this ARexx script into an editor for more info."
EXIT
END
If ~Show("P",DOpusPort) Then Do
Say DOpusPort "is not a valid port."
EXIT
End
Address value DOpusPort
Quit_After = "NO"
If ~Show("P","Virus_Checker") Then Do
Address Command Virus_Checker
Quit_After = "YES"
TickTick = Time(M)
Do While ~Show("P","Virus_Checker")
IF Time(M) - TickTick > 1 Then Do
dopus request '"Error loading Virus_Checker!'|| '0a'x ||'Check its command-line in the ARexx script itself." OK'
EXIT
END
END
END
/* If file/dir-path was specified on command line, check it, else
go through all the selected ones. */
BadList = ""
BadNumber = 0
/*
lister query source stem source_handle.
IF source_handle.count = 0 | source_handle.count = "SOURCE_HANDLE.COUNT" Then Do
dopus request '"You must have a SOURCE lister!" OK'
EXIT
End
*/
If FilePath = "" Then Do
lister set source_handle.0 busy 1
lister query source_handle.0 numselentries /* Get info about selected */
Lister_NumSelEnt = RESULT /* entries & path to them */
lister query source_handle.0 path
Lister_Path = Strip(RESULT,"B",'"')
lister set source_handle.0 progress Lister_NumSelEnt "Checking for viruses..."
Do i=1 to Lister_NumSelEnt
lister query source_handle.0 abort
If RESULT=1 Then BREAK
lister query source_handle.0 firstsel
Temp_Name = Strip(RESULT,"B",'"')
lister select source_handle.0 Temp_Name 0
Temp_Path = Lister_Path || Temp_Name
lister set source_handle.0 progress name Temp_Name
lister set source_handle.0 progress count i
Address "Virus_Checker" "Scan "||Temp_Path
If VCHECK.0.0 ~= 0 Then Do
command beep
Do x=1 to VCHECK.0.0
BadNumber = BadNumber + 1
BadList = BadList || '0a'x || VCHECK.x.1 ||" (" || VCHECK.x.2 || ")"
END
END
END
lister clear source_handle.0 progress
End
ELSE Do
lister set source_handle.0 progress "-1" "Checking for viruses..."
Address "Virus_Checker" "Scan "||FilePath
If VCHECK.0.0 ~= 0 Then Do
command beep
Do x=1 to VCHECK.0.0
BadNumber = BadNumber + 1
BadList = BadList || '0a'x || VCHECK.x.1 ||" (" || VCHECK.x.2 || ")"
END
END
lister clear source_handle.0 progress
End
If BadNumber > 0 Then Do
If BadNumber = 1 Then
BadNote = "The following file is infected:"
Else
BadNote = "The following files are infected:"
BadList = "*VIRUS WARNING*" || '0a'x || BadNote || '0a'x || "(Virus name in parenthesis)" || '0a'x || BadList
dopus request '"'||BadList||'" OK'
/* As there is only one gadget which returns "RC = 1", when "RC = 0" it means
that the requester failed to appear. This will happen when the list is too
long or wide to fit on the screen, which could easily happen with a virus
which has spread itself to many files!
So, if the requester failed, the output will be sent to a shell window.
It would be nice to be able to use the user's defined output-window
size but there is (currently) no way of obtaining this. */
IF RC = 0 Then Do
dopus request '"*VIRUS WARNING*' || '0a'x || 'List too large for requester' || '0a'x || 'and will be output to a shell..." OK'
Open(Output_Shell,"CON:0/1/640/200/Virus Warning/CLOSE/WAIT","W")
WriteLN(Output_Shell,BadList)
Close(Output_Shell)
END
END
/*-- Restore the Lister for normal use --------------------------------------*/
syntax:;ioerr: /* In case of error, jump here */
END_PART_2:
lister clear source_handle.0 progress
If FilePath = "" Then Do
lister refresh source_handle.0
lister set source_handle.0 busy 0
END
END_PART:
If Quit_After = "YES" Then Address "Virus_Checker" QUIT
EXIT